--- import { type CollectionEntry, getCollection } from "astro:content"; import Comments from "../../components/Comments.astro"; import Layout from "../../layouts/BaseLayout.astro"; import dayjs from "dayjs"; type Props = CollectionEntry<"blog">; export async function getStaticPaths() { const posts = await getCollection("blog", ({ data }) => { return data.draft !== true; }); return posts.map((post) => ({ params: { slug: post.slug }, props: post, })); } const post = Astro.props; const { Content, remarkPluginFrontmatter } = await post.render(); const formattedDate = dayjs(post.data.pubDate.toString()).format("MMMM DD, YYYY"); --- <style lang="scss"> @import "../../scss/_variables.scss"; p { opacity: 0.5; } </style> <Layout description={post.data.description} title={post.data.title}> <article> <section> <p> <small> Posted <time datetime={post.data.pubDate.toISOString()}>{formattedDate}</time> by {post.data.author} <span> • </span> <span>{remarkPluginFrontmatter.minutesRead}</span> </small> </p> </section> <section> <h1>{post.data.title}</h1> </section> <section> <Content /> </section> <section> <Comments /> </section> </article> </Layout>